import request from '@/axios';

export const getList = (current, size, params) => request({
  url: '/zzy-system/menu/list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
  },
});

export const getLazyList = (parentId, params) => request({
  url: '/zzy-system/menu/lazy-list',
  method: 'get',
  params: {
    ...params,
    parentId,
  },
});

export const getLazyMenuList = (parentId, params) => request({
  url: '/zzy-system/menu/lazy-menu-list',
  method: 'get',
  params: {
    ...params,
    parentId,
  },
});

export const getMenuList = (current, size, params) => request({
  url: '/zzy-system/menu/menu-list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
  },
});

export const getMenuTree = tenantId => request({
  url: '/zzy-system/menu/tree',
  method: 'get',
  params: {
    tenantId,
  },
});

export const remove = ids => request({
  url: '/zzy-system/menu/remove',
  method: 'post',
  params: {
    ids,
  },
});

export const add = row => request({
  url: '/zzy-system/menu/submit',
  method: 'post',
  data: row,
});

export const update = row => request({
  url: '/zzy-system/menu/submit',
  method: 'post',
  data: row,
});

export const getMenu = id => request({
  url: '/zzy-system/menu/detail',
  method: 'get',
  params: {
    id,
  },
});

export const getTopMenu = () => request({
  url: '/zzy-system/menu/top-menu',
  method: 'get',
});

export const getRoutes = topMenuId => request({
  url: '/zzy-system/menu/routes',
  method: 'get',
  params: {
    topMenuId,
  },
});
